<?php
/**
 * テーブルコンポーネントクラスモジュール
 */
require_once dirname(__FILE__). '/Components.php';

/**
 * テーブルコンポーネントクラス
 * Enter description here ...
 * @author admin
 *
 */
class Smarty_Components_Table extends  Smarty_Components
{
	/** @var TABLE属性リスト */
	public $TableAttrList = array();
	/** @var テーブルヘッダTR属性リスト */
	public $TrThAttrList = array();
	/** @var テーブルヘッダデータセット */
	public $ThDataset = array();
	/** @var TH属性リスト */
	public $ThAttrList = array();
	/** @var テーブルデータセット */
	public $TableDataset = array();
	/** @var ＴＲ属性リスト */
	public $TrAttrList = array();
	/** @var ＴＤ属性リスト */
	public $TdAttrList = array();
	/** @var 奇数トラックトラック属性 */
	public $OddTrAttrList = array();
	/** @var 偶数トラックトラック属性 */
	public $EvenTrAttrList = array();
	/** ＴＨ存在判定フラグ */
	public $ThExists = FALSE;

	const TEMPLATE_NAME = "table.tpl";

	/**
	 * コンストラクタ
	 * Enter description here ...
	 * @param  $sCompileDir
	 * @param  $sCompileId
	 */
	public function __construct($sCompileDir, $sCompileId)
	{
		parent::__construct(dirname(__FILE__), $sCompileDir, $sCompileId);
	}

	public function fetch()
	{
		/** トラックヘッダデータがある場合、存在判定フラグを設定する */
		if ( count($this->ThDataset) > 0 ) {
			$this->ThExists = TRUE;
		}

		$this->view->TableAttrList = $this->TableAttrList;
		$this->view->TableDataset = $this->TableDataset;
		$this->view->TdAttrList = $this->TdAttrList;
		$this->view->ThAttrList = $this->ThAttrList;
		$this->view->ThDataset = $this->ThDataset;
		$this->view->ThExists = $this->ThExists;
		$this->view->TrAttrList = $this->TrAttrList;
		$this->view->TrThAttrList = $this->TrThAttrList;
		$this->view->ThAttrCount = count($this->ThAttrList);
		$this->view->OddTrAttrList = $this->OddTrAttrList;
		$this->view->EvenTrAttrList = $this->EvenTrAttrList;
		$sHtml = parent::fetch(self::TEMPLATE_NAME);
		return $sHtml;
	}
}